package com.molichuxing.job;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.molichuxing.service.OrderEnterpriseJobService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;

@JobHandler(value = "orderEnterpriseRenewHandler")
@Component
public class OrderEnterpriseRenewHandler extends IJobHandler {
	private static final Logger logger = LoggerFactory.getLogger(OrderEnterpriseRenewHandler.class);

	@Resource
	private OrderEnterpriseJobService orderEnterpriseJobService;

	public OrderEnterpriseRenewHandler() {
        super();
    }

	@Override
	public void init() {
		super.init();
	}

	@Override
	public void destroy() {
		super.destroy();
	}

	@Override
	public ReturnT<String> execute(String param) throws Exception {
		ReturnT<String> returnT = ReturnT.SUCCESS;
		logger.info("==============企业续租订单自动起租定时任务start================");
		boolean result = orderEnterpriseJobService.orderEnterpriseRenew();
		if (!result) {
			returnT = ReturnT.FAIL;
		}
		logger.info("==============企业续租订单自动起租定时任务end================");
		returnT.setContent("企业续租订单自动起租定时任务结果result：" + result);
		return returnT;
	}

}
